
//
//  UIButton+Action.m
//  tanchuangtest
//
//  Created by 邹浩 on 15/5/27.
//  Copyright (c) 2015年 蓝鸥. All rights reserved.
//

#import "UIButton+Action.h"
#import <objc/runtime.h>



static const void *ActionKey = &ActionKey;
@implementation UIButton (Action)


@dynamic block;
- (void)setBlock:(Block)block
{
    objc_setAssociatedObject(self, ActionKey, block, OBJC_ASSOCIATION_COPY_NONATOMIC);
}

- (Block)block
{
    return objc_getAssociatedObject(self, ActionKey);
}

- (void)addTAgeTWithblock:(void (^)(void))block
{
 
    self.block = [block copy];
    
    [self addTarget:self action:@selector(chooseTheButton) forControlEvents:UIControlEventTouchUpInside];
}

//- (void)chooseTheButton
//{
//    self.block();
//}



@end
